package org.blade.personal.framework.dsl.express.concre;

import org.blade.personal.framework.dsl.Clause;
import org.blade.personal.framework.dsl.express.AbstractExpression;
import org.blade.personal.framework.dsl.express.Expression;

/**
 * MySQL 表达式
 * @author Thinkpad
 *
 */
public class MySQLExpression extends AbstractExpression{

	/**
	 * 初始化
	 * @param alise 表别名
	 * @param val 表达式
	 */
	public MySQLExpression(String alise, StringBuilder val) {
		this.alias = alise;
		this.val = val;
	}
	
	/**
	 * 初始化
	 * @param val
	 */
	public MySQLExpression(StringBuilder val){
		this.val = val;
	}

	@Override
	public void setClause(Clause clause) {
		this.expre = (Expression)clause;
	}

	@Override
	public String build() {
		if(this.expre == null){
			return this.val.toString();
		}
		return this.val.append(expre.build()).toString();
	}

}
